import React, { Fragment } from 'react'
import './index.less'
import renderRoutes from 'libs/routes'
import { SideMenu, HelpCenter } from 'components'
import { NavLink } from 'react-router-dom'

export default class MyCourses extends React.Component {
  state = {
    menuData: [
      { path: '/student_center/my_courses/layout/live_course_list', name: '直播课程' },
      { path: '/student_center/my_courses/layout/recorded_course_list', name: '录播课程' },
      { path: '/student_center/my_courses/layout/course_material', name: '课程资料' },
      { path: '/student_center/my_courses/layout/daily_challenge', name: '每日挑战' },
      { path: '/student_center/my_courses/layout/course_detail', name: '课时明细' },
      { path: '/student_center/my_courses/layout/notes_in_class', name: '上课须知' },
    ]
  }
  oddEvent = (match, location) => {
    if (location.pathname.indexOf('course_material') > -1) {
      return true
    }else{
      return false
    }
  }
  render() {
    return (
      <Fragment>
        <div className="my-courses">
          {/* <SideMenu menuData={this.state.menuData} /> */}
          <div className="side-menu">
            <NavLink key='/student_center/my_courses/layout/live_course_list' className="menu-item" to='/student_center/my_courses/layout/live_course_list'>直播课程</NavLink>
            <NavLink key='/student_center/my_courses/layout/recorded_course_list' className="menu-item" to='/student_center/my_courses/layout/recorded_course_list'>录播课程</NavLink>
            <NavLink key='/student_center/my_courses/layout/course_material' isActive={this.oddEvent} className="menu-item" to='/student_center/my_courses/layout/course_material'>课程资料</NavLink>
            <NavLink key='/student_center/my_courses/layout/daily_challenge' className="menu-item" to='/student_center/my_courses/layout/daily_challenge'>每日挑战</NavLink>
            <NavLink key='/student_center/my_courses/layout/course_detail' className="menu-item" to='/student_center/my_courses/layout/course_detail'>课时明细</NavLink>
            <NavLink key='/student_center/my_courses/layout/notes_in_class' className="menu-item" to='/student_center/my_courses/layout/notes_in_class'>上课须知</NavLink>
          </div>
          <div className="main-container">
            { renderRoutes('/student_center/my_courses') }
          </div>
        </div>
        {/* <HelpCenter /> */}
      </Fragment>
    )
  }
}